package com.itheima.d1_inner_class1;

/*

 */
public class Demo {
    public static void main(String[] args) {
        // 目标：了解成员内部类和其特点。
        Car.Engine engine = new Car(). new Engine();

        engine.start();
    }
}


class  Car{
    private String name = "兰博基尼";

    public void  run(){
        System.out.println("开车");
    }

    public  class  Engine{
        private String name = "奔驰";
        public  void start(){

            //内部类调用内部类 成员变量，成员方法可以省略外部类名.this  如果有重复对象不可省略
            System.out.println("启动");
            System.out.println(name);//就近原则
            System.out.println(this.name);
            System.out.println(Car.this.name);
            run();
        }
    }
}